'use strict';
const orderState = require('../../../../../application/service/orderState.js')
const applicationConstant = require('../../../../../application/constant/applicationsConstant.js')
const businessState = require('../../../../../application/service/businessState.js')
const orderPaySuccess = require('../../../../../application/service/orderPaySuccess.js');
module.exports = {
	/**
	 * 充值学习币
	 * @url client/order/kh/create/coin 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		//数据准备
		let promoCodeId = ""
		let title = '充值学习币'
		let total = data.amount
		let platform = data.platform
		let type = 'recharge'
		let goods_item = [{
			'oid': null,
			'user_id': uid,
			'charge': total,
			'type': type,
			'num': 1,
			'goods_name': title,
		}]

		//统一创建订单
		res = await orderState.createOrder(event, uid, total, title, type, platform, goods_item, promoCodeId)

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
